package com.changgou.goods.service.impl;

import com.changgou.goods.dao.SpecMapper;
import com.changgou.goods.service.SpecService;
import com.changgou.goods.pojo.Spec;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;


@Service
public class SpecServiceImpl implements SpecService {

    @Autowired
    private SpecMapper specMapper;


    @Override
    public void SpecName(Spec spec) {
        specMapper.insert(spec);
    }

    @Override
    public void SpecDeleteId(int id) {
        specMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Page<Spec> pageSpec(int current, int pageSize) {
        PageHelper.startPage(current, pageSize);
        Example example = new Example(Spec.class);
        Example.Criteria criteria = example.createCriteria();
        return (Page<Spec>) specMapper.selectByExample(example);

    }


}
